package org.atovio.tx.service.impl;

import org.atovio.tx.mapper.CVMapper;
import org.atovio.tx.mapper.PeopleMapper;
import org.atovio.tx.pojo.CV;
import org.atovio.tx.pojo.People;
import org.atovio.tx.service.PeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author AtoVio, Winter Yuan
 */
@Service
public class FirstPeopleService implements PeopleService {

    @Autowired
    private PeopleMapper peopleMapper;

    @Autowired
    private CVMapper cvMapper;

    @Override
    @Transactional
    public int addPeople(People people, CV cv) {
        // 添加人
        int rows1 = peopleMapper.insertPeople(people);

        // 添加cv
        int rows2 = cvMapper.insertCV(cv);

        return rows1 + rows2;
    }
}
